package com.nabi.library.contents.elements
{
	import com.nabi.library.contents.elements.segment.Segment;
	import com.yzi.core.collection.IIterator;
	import com.yzi.core.collection.LinkedList;
	
	import flash.display.IGraphicsPath;
	
	public class Outline extends LinkedList implements IGraphicsPath
	{
		private var m_commands:Vector.<int>;
		private var m_data:Vector.<Number>;
		
		public function Outline()
		{
			init();
		}
		
		private function init(): void
		{
			m_commands = new Vector.<int>();
			m_data = new Vector.<Number>();
		}
		
		public function Update(): void
		{
			m_data.length = m_commands.length = 0;
			var iterator:IIterator = GetIterator();
			
			while(iterator.HasNext())
			{
				var segment:Segment = iterator.Next();
				m_commands = m_commands.concat(segment.GetCommands());
				m_data = m_data.concat(segment.GetPoints());
			}
		}
		
		public function GetCommands(): Vector.<int> { return m_commands; }
		
		public function GetPoints(): Vector.<Number> { return m_data; }
	}
}